This chapter describes how to use the Internet Connection Server commands.
The cgiparse command handles QUERY_STRING environment variable parsing for CGI scripts. If the QUERY_STRING environment variable is not set, it reads CONTENT_LENGTH characters from its standard input.
This corresponds to the GET and POST methods from HTML forms. QUERY_STRING and CONTENT_LENGTH are environment variables. For a GET request, QUERY_STRING holds the form data. For a POST request, CONTENT_LENGTH is set and the form data is sent on standard input.
cgiparse -Flag [Modifier]
Flags have one-character equivalents: -k -f -v -r -i -s -p -c -n -q
'cgiparse -init > tempfile' 'CALL tempfile'
After this command the QUERY_STRING environment variable will be set regardless of whether the GET or POST method was used. Therefore cgiparse may be called multiple times in the same script. Otherwise with POST it could only be called once because after that the stdin would be already read, and the next cgiparse would hang.
Use the cgiutils command in no-parse header programs to produce a full HTTP 1.0 response.
cgiutils -Flag [Modifier]
If Modifier contains blanks, enclose it in quotes.
cgiutils -ct text/html
The following example results in use of the default content type of text/plain
cgiutils -ct
cgiutils -ce x-compress
cgiutils -dl en_UK
cgiutils -expires 2 days 12 hoursThe cgiutils command adds the time you specify to the current Greenwich Mean Time to determine the expiration date. The expiration date is written on the Expires: header in the HTTP format.
cgiutils -expires "1 year 3 months 2 weeks 4 days 12 hours 30 mins"
cgiutils -status 200 -reason "Virtual doc follows" -expires nowThe above command would produce headers similar to the following:
HTTP/1.0 200 Virtual doc follows MIME-Version: 1.0 Server: IBM-ICS Date: Tuesday, 05-Jan-96 03:43:46 GMT Expires: Tuesday, 05-Jan-96 03:43:46 GMTThere is a blank line after the output to mark the end of the MIME header section. If you want to output some more headers yourself, use the -noel (NO-Empty-Line) flag.
The cgiutils command automatically produces the Server: header because it is available in the CGI environment. The Date: field is also automatically generated unless the -nodate flag is specified.
Note: If you want to supply your own no-parse header (nph) programs specifically to return your own return values, the name of the program must begin with nph-. This prevents the server header from overriding your return value with the standard server return value.
cgiutils -noel -expires "2 days" -nodateThe above command produces headers similar to the following without a blank line after the headers.
HTTP/1.0 200 Virtual doc follows MIME-Version: 1.0 Server: IBM-ICS Expires: Tuesday, 07-Jan-96 03:43:46 GMT
Use the htadm command to control your server password files. Your server uses password files to control access to your files. See Chapter 7. "Protecting Your Server" for information about controlling access to your server's resources. With htadm you can add a user name to a password file, delete a user from a password file, change a password for a user, check on a user's password, and create an empty password file.
Note: When you use htadm to add a user, change a password, or check a password, you must enter the password on the command line. Because htadm destroys the password from the command line as soon as possible, it is highly unlikely that you can see a user's password by looking at the process listing on the machine (with the pstat command, for example).
htadm -Flag Modifier
Use only alphabetic and numeric characters for the user name; do not use special characters.
The command fails if there is already a user of the same name in the password file.
Passwords can be up to 32 characters long. Use only alphabetic and numeric characters for the password; do not use special characters.
Note: Some browsers are unable to read and send passwords longer than eight characters. Because of this limitation, if you define a password longer than eight characters, the server recognizes either the complete password or just the first eight characters of the password as valid.
Passwords can be up to 32 characters long. Use only alphabetic and numeric characters for the password; do not use special characters.
Note: Some browsers are unable to read and send passwords longer than eight characters. Because of this limitation, if you define a password longer than eight characters, the server recognizes either the complete password or just the first eight characters of the password as valid.
htadm -adduser d:\tcpip\etc\heroes.pwd clark superman "Clark Kent"
htadm -deluser d:\tcpip\etc\heroes.pwd clark
Use the htimage command to process clickable image maps. The htimage command is located in the CGI Bin scripts directory you specified at installation. The installation default is C:\WWW\CGI-BIN.
The htimage command is a CGI script that executes based upon the regions clicked within a graphics file. The command is used in conjunction with a map file. Map files are text files that maps locations within the graphic to various URLs. See the "Using Images and Multimedia" on our Website for additional information on using htimage and creating map files.
Currently the universal image file accepted by all browsers and servers is the GIF format. GIF is an 8-bit 256 color image file.
You call the htimage command from an anchor tag within an HTML document. (You cannot use htimage from the command line.)
Since htimage can only be called from an anchor tag within an HTML document, the syntax is shown as HTML markup.
<A HREF="/CGI-BIN/htimage/mapfile.txt"> <IMG SRC="/ICONS/image.gif" ISMAP></A>
This syntax description assumes that the default configuration file is being used. The default configuration file contains an Exec directive that maps requests beginning with /CGI-BIN/ to the directory that contains the htimage command.
The server uses everything following /htimage/ as the URL of the map file. If the server is using the default configuration and the URL contains only a file name, the server would look for the file in the document root directory.
The ISMAP attribute indicates that the graphic is an image map.
Following is a description of the map files that must be used with the htimage command. A map file is a text file. Each line of the file is in the following format:
region-identifier [region-definition] URL
Coordinates within parentheses identify a point relative to the top left corner of the image. The first number is the number of pixels to the right of the top left corner. The second number is the number of pixels down from the top left corner. There are several shareware programs available that can help you easily identify the coordinates of particular points within a graphic file.
default URL rectangle (x1,y1) (x2,xy) URL circle (x,y) r URL polygon (x1,y1) (x2,y2) (x3,y3) URL
For example, you might use the following HTML in a document:
<A HREF="/cgi-bin/htimage/mapit.txt"> <IMG SRC="/icons/mapimage.gif" ISMAP></A>
The above example calls the htimage command with a map file named mapit.txt. The mapit.txt file would define regions of the mapimage.gif graphic file. Because no path is specified for mapit.txt, the server would look for it on the document root directory. Following is an example of what mapit.txt might look like.
default /cgi-bin/go_home rectangle (50, 100) (200,200) /cgi-bin/go_to_it circle (100,300) 50 /pub/example.html polygon (450,350) (450,500) (150, 500) /pub/triangle.html
One example of a shareware program for determining the x,y coordinates
is mapedit.
You can obtain mapedit from the following URL:
http://sunsite.unc.edu/~boutell/mapedit/mapedit.html
Use the whttpg command to start the Internet Connection Server.
You can use the Directory argument, to indicate the directory to be exported. If not present, a rule file can be used to export combinations of directories. The default setting is to export the /Public directory tree.
You can set all these flags (except -r) using the directives in the server configuration file. You can set the directory-browsing flags with the DirAccess configuration directive. It is common practice to create a file named README containing instructions or notices to be read by anyone new to the directory. whttpg will by default imbed any README file in the hypertext version of a directory. The README file instructions can also be set with the DirReadme configuration directive.
whttpg [-Flag [-Flag [-Flag..]]]
whttpg -r D:\TCPIP\httpd.config -p 80
If the Port directive is given in the configuration file, the -p flag is not required. The -p flag can be used to override the value set in the configuration file.